package com.mk.es.service.transport.entity;

import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.aggregations.AggregationBuilder;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.SortBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.search.suggest.SuggestBuilder;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 *  es dsl 查询请求参数
 */
public class EsQueryBuilder implements Serializable {
    private static final long serialVersionUID = -7047037081506758407L;

    /**  */
    private String[] fields;
    /** 查询 */
    private QueryBuilder queryBuilder;
    /** 高亮字段 */
    private HighlightBuilder highlightBuilder;
    /** 聚合 */
    private List<AggregationBuilder> aggregations;
    /**  */
    private SuggestBuilder suggestBuilder;
    /**  */
    private QueryBuilder postFilter;
    /** 排序，可以设置排序详细，sorts和sortMap只要使用一个就好 */
    private List<SortBuilder> sorts;
    /** 排序，只设置升序或降序，其他排序配置默认，sorts和sortMap只要使用一个就好 */
    private Map<String, SortOrder> sortMap;
    /** 从命中的索引开始返回。默认值为 0 */
    private Integer from = 0;
    /** 要返回的匹配数。默认值为 10 */
    private Integer size = 20;
    /**  搜索超时，将搜索请求限制为在指定的时间值内执行并且保留与到期时累积的点击数。默认为无超时 */
    private TimeValue timeout;
    /** 最小分数 */
    private Float minScore;
    /** 详细评分数据 */
    private Boolean explain;
    /** 显示版本信息 */
    private Boolean version;
    /**  */
    private List<String> docValueFields;
    /**  */
    private List<String> storedFields;


    public String[] getFields() {
        return fields;
    }

    public void setFields(String[] fields) {
        this.fields = fields;
    }

    public QueryBuilder getQueryBuilder() {
        return queryBuilder;
    }

    public void setQueryBuilder(QueryBuilder queryBuilder) {
        this.queryBuilder = queryBuilder;
    }

    public HighlightBuilder getHighlightBuilder() {
        return highlightBuilder;
    }

    public void setHighlightBuilder(HighlightBuilder highlightBuilder) {
        this.highlightBuilder = highlightBuilder;
    }

    public List<AggregationBuilder> getAggregations() {
        return aggregations;
    }

    public void setAggregations(List<AggregationBuilder> aggregations) {
        this.aggregations = aggregations;
    }

    public SuggestBuilder getSuggestBuilder() {
        return suggestBuilder;
    }

    public void setSuggestBuilder(SuggestBuilder suggestBuilder) {
        this.suggestBuilder = suggestBuilder;
    }

    public QueryBuilder getPostFilter() {
        return postFilter;
    }

    public void setPostFilter(QueryBuilder postFilter) {
        this.postFilter = postFilter;
    }

    public List<SortBuilder> getSorts() {
        return sorts;
    }

    public void setSorts(List<SortBuilder> sorts) {
        this.sorts = sorts;
    }

    public Map<String, SortOrder> getSortMap() {
        return sortMap;
    }

    public void setSortMap(Map<String, SortOrder> sortMap) {
        this.sortMap = sortMap;
    }

    public Integer getFrom() {
        return from;
    }

    public void setFrom(Integer from) {
        this.from = from;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    public TimeValue getTimeout() {
        return timeout;
    }

    public void setTimeout(TimeValue timeout) {
        this.timeout = timeout;
    }

    public Float getMinScore() {
        return minScore;
    }

    public void setMinScore(Float minScore) {
        this.minScore = minScore;
    }

    public Boolean getExplain() {
        return explain;
    }

    public void setExplain(Boolean explain) {
        this.explain = explain;
    }

    public Boolean getVersion() {
        return version;
    }

    public void setVersion(Boolean version) {
        this.version = version;
    }

    public List<String> getDocValueFields() {
        return docValueFields;
    }

    public void setDocValueFields(List<String> docValueFields) {
        this.docValueFields = docValueFields;
    }

    public List<String> getStoredFields() {
        return storedFields;
    }

    public void setStoredFields(List<String> storedFields) {
        this.storedFields = storedFields;
    }
}
